<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>贴图模式</title>
<style type="text/css">
canvas{
	border:1px solid #000;
}
</style>
<script type="text/javascript">
function Draw(){
	var canvas=document.getElementById("canvas");
	var context = canvas.getContext("2d");
	var img = new Image();
  	img.src = '../images/flower.gif';
  	img.onload = function(){
		var ptrn = context.createPattern(img,'repeat');
		context.fillStyle = ptrn;
		context.fillRect(0,0,300,200);
	}
}
window.addEventListener("load",Draw,true);
</script>
</head>
<body style="overflow:hidden">
<canvas id="canvas" width="400" height="300">你的浏览器不支持该功能！</canvas>
</body>
</html>
